import java.util.List;
import java.util.ArrayList;

// 组件接口
interface Component {
    void display();
}

// 叶子对象
class Employee implements Component {
    private String name;

    public Employee(String name) {
        this.name = name;
    }

    public void display() {
        System.out.println("Employee: " + name);
    }
}

// 组合对象
class Department implements Component {
    private String name;
    private List<Component> employees = new ArrayList<>();

    public Department(String name) {
        this.name = name;
    }

    public void add(Component employee) {
        employees.add(employee);
    }

    public void display() {
        System.out.println("Department: " + name);
        for (Component employee : employees) {
            employee.display();
        }
    }
}

// 客户端代码
public class Main {
    public static void main(String[] args) {
        Department engineering = new Department("Engineering");
        engineering.add(new Employee("Alice"));
        engineering.add(new Employee("Bob"));

        Department sales = new Department("Sales");
        sales.add(new Employee("Charlie"));
        sales.add(new Employee("David"));

        Department organization = new Department("Organization");
        organization.add(engineering);
        organization.add(sales);

        organization.display();
    }
}
